import 'package:amway_superapp_creator_plugin/widget/drag_sort_view.dart';
import 'package:json_annotation/json_annotation.dart';

part 'create_user_info_model.g.dart';

@JsonSerializable()
class CreateUserInfoModel {
  String id;
  String ada;
  String amwayId = "";
  List<DisplayAuditsBean> displayAudits = [];
  String auditStatus;
  List<ImagesBean> coverList = [];
  num createTime;
  String douYinCode = "";
  ImagesBean douYinQRCode;
  List<String> identityMarks = [];
  List<String> interestMarks;
  String introduce = "";
  String kuaiShouCode = "";
  ImagesBean kuaiShouQRCode;
  String mobile = "";
  String nick = "";
  ImagesBean personalSign;
  String publishStatus;
  String wxCode;
  String wxEnterpriseCode;
  ImagesBean wxEnterpriseQRCode;

  CreateUserInfoModel(
      {this.id,
      this.ada,
      this.amwayId = "",
      this.displayAudits,
      this.auditStatus,
      this.coverList,
      this.createTime,
      this.douYinCode,
      this.douYinQRCode,
      this.identityMarks,
      this.interestMarks,
      this.introduce,
      this.kuaiShouCode,
      this.kuaiShouQRCode,
      this.mobile = "",
      this.nick = "",
      this.personalSign,
      this.publishStatus,
      this.wxCode,
      this.wxEnterpriseCode,
      this.wxEnterpriseQRCode});

  factory CreateUserInfoModel.fromJson(Map<String, dynamic> json) =>
      _$CreateUserInfoModelFromJson(json);

  Map<String, dynamic> toJson() => _$CreateUserInfoModelToJson(this);

  @override
  bool operator ==(Object other) {
    if (other is CreateUserInfoModel) {
      if (this.kuaiShouQRCode == null) {
        this.kuaiShouQRCode = ImagesBean(data: "");
      }
      if (other.kuaiShouQRCode == null) {
        other.kuaiShouQRCode = ImagesBean(data: "");
      }
      if (this.douYinQRCode == null) {
        this.douYinQRCode = ImagesBean(data: "");
      }
      if (other.douYinQRCode == null) {
        other.douYinQRCode = ImagesBean(data: "");
      }
      if (this.wxEnterpriseQRCode == null) {
        this.wxEnterpriseQRCode = ImagesBean(data: "");
      }
      if (other.wxEnterpriseQRCode == null) {
        other.wxEnterpriseQRCode = ImagesBean(data: "");
      }
      if (other.personalSign == null) {
        other.personalSign = ImagesBean(data: "");
      }

      if (this.coverList.length == other.coverList.length) {
        for (int i = 0; i < this.coverList.length; i++) {
          for (int j = 0; j < other.coverList.length; j++) {
            if (i == j) {
              if (this.coverList[i].data != other.coverList[j].data) {
                return false;
              }
            } else {
              continue;
            }
          }
        }
      } else {
        return false;
      }

      if (this.nick == other.nick &&
          this.introduce == other.introduce &&
          this.interestMarks.join(',') == other.interestMarks.join(',') &&
          this.identityMarks.join(',') == other.identityMarks.join(',') &&
          this.kuaiShouQRCode.data == other.kuaiShouQRCode.data &&
          this.personalSign.data == other.personalSign.data &&
          this.kuaiShouCode == other.kuaiShouCode &&
          this.douYinQRCode.data == other.douYinQRCode.data &&
          this.douYinCode == other.douYinCode &&
          this.wxEnterpriseQRCode.data == other.wxEnterpriseQRCode.data &&
          this.wxCode == other.wxCode &&
          this.mobile == other.mobile) {
        return true;
      } else {
        return false;
      }
    }
    return false;
  }
}

@JsonSerializable()
class ImagesBean extends DragBean {
  String data = "";
  String dataType;
  int no;
  String officialFlag;
  String fileId;
  int imageVerify = 0;
  int state; //1审核中  3审核不通过  2 通过
  ImagesBean(
      {this.data = "",
      this.dataType,
      this.no,
      this.officialFlag,
      this.fileId,
      this.state,
      this.imageVerify = 0});

  factory ImagesBean.fromJson(Map<String, dynamic> json) =>
      _$ImagesBeanFromJson(json);

  Map<String, dynamic> toJson() => _$ImagesBeanToJson(this);

  @override
  bool operator ==(Object other) {
    if (other is ImagesBean) {
      if (this.data == other.data) {
        return true;
      } else {
        return false;
      }
    }
    return false;
  }
}

@JsonSerializable()
class DisplayAuditsBean {
  num id;
  String data;
  num no;
  String propertyNameTip;
  String resourceType;
  String status;

  DisplayAuditsBean(
      {this.id,
      this.data,
      this.no,
      this.propertyNameTip,
      this.resourceType,
      this.status});

  factory DisplayAuditsBean.fromJson(Map<String, dynamic> json) =>
      _$DisplayAuditsBeanFromJson(json);

  Map<String, dynamic> toJson() => _$DisplayAuditsBeanToJson(this);
}
